package com.hgyc.mom.mes.service.impl;

import com.hgyc.mom.mes.service.MesWorkshopMachineService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hgyc.mom.mes.mapper.MesWorkshopMachineMapper;
import com.hgyc.mom.mes.entity.MesWorkshopMachine;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import lombok.extern.slf4j.Slf4j;

/**
 * 车间建模设备信息 Service业务层实现
 *
 * @author fwj
 * @since 2025-06-23
 */
@Slf4j
@Service
public class MesWorkshopMachineServiceImpl extends ServiceImpl<MesWorkshopMachineMapper, MesWorkshopMachine> implements MesWorkshopMachineService {

    @Override
    public List<MesWorkshopMachine> getByParentId(Long parentId) {
        LambdaQueryWrapper<MesWorkshopMachine> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(MesWorkshopMachine::getWorkshopId, parentId);
        return list(wrapper);
    }

    @Override
    public void deleteByParentId(Long parentId) {
        LambdaQueryWrapper<MesWorkshopMachine> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(MesWorkshopMachine::getWorkshopId, parentId);
        remove(wrapper);
    }

    @Override
    public void deleteBatchByParentIds(List<Long> parentIds) {
        LambdaQueryWrapper<MesWorkshopMachine> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(MesWorkshopMachine::getWorkshopId, parentIds);
        remove(wrapper);
    }
}